package generic;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * @author 15594
 */
public class MethodGeneric {

    /**
    * 根据传入的参数类型返回参数
    * @param e 传入的泛型类型
    * @return 返回泛型类型
    * */
    public <E> E test(E e){
        return e;
    }

    public static  <E> ArrayList<E> test1(E e){
        ArrayList<E> list = new ArrayList<>();
        list.add(e);
        return list;
    }

    public static void main(String[] args) {

        MethodGeneric generic = new MethodGeneric();
        System.out.println(generic.test(1));

        ArrayList<String> strings = MethodGeneric.test1("111");
        System.out.println(strings.toString());

    }
}
